Skip to content

Conversation

@PrakharJain1509
Copy link

@PrakharJain1509 PrakharJain1509 commented Oct 27, 2025

Description

Adds __repr__ methods to the CustomFee base class and all subclasses (CustomFixedFee, CustomFractionalFee, CustomRoyaltyFee) to improve debugging by displaying key attributes.

Changes

  • Added __repr__ method to CustomFee base class showing fee_collector_account_id and all_collectors_are_exempt
  • Added __repr__ method to CustomFixedFee showing amount, denominating_token_id, fee_collector_account_id, and all_collectors_are_exempt
  • Added __repr__ method to CustomFractionalFee showing numerator, denominator, min/max amounts, assessment_method, fee_collector_account_id, and all_collectors_are_exempt
  • Added __repr__ method to CustomRoyaltyFee showing numerator, denominator, fallback_fee, fee_collector_account_id, and all_collectors_are_exempt
  • Expanded unit tests in test_custom_fee.py and test_custom_fee_limit.py to verify repr functionality
  • Updated examples/custom_fee.py to demonstrate repr output
  • Added CHANGELOG entry under Added section

Testing

Added comprehensive unit tests verifying the repr output for all custom fee types including edge cases (None values, missing collectors, etc.).

Example Output

When debugging CustomFixedFee, the output will now show:

CustomFixedFee(amount=100, denominating_token_id=0.0.123, fee_collector_account_id=0.0.456, all_collectors_are_exempt=True)

Instead of the generic <hiero_sdk_python.tokens.custom_fixed_fee.CustomFixedFee object at 0x...> representation.

Fixes: #583

Add __repr__ method to CustomFee base class displaying
fee_collector_account_id and all_collectors_are_exempt
for improved debugging experience.

- Add __repr__ method to CustomFee base class
- Add unit test for __repr__ method
- Add CHANGELOG entry

Signed-off-by: prakharjain <[email protected]>
@PrakharJain1509
Copy link
Author

@exploreriii Please have a look into this.. I made the required changes

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much, did you also need to change the exmaple?

@PrakharJain1509
Copy link
Author

Thank you so much, did you also need to change the exmaple?

No, I didnt change the examples. Is there something I need to do.. if so please let me know

@exploreriii
Copy link
Contributor

Thanks, I'll take a look. Sorry it will take some time
If this is your only oustanding issue and you have met the requirements otheriwse, feel free to find another issue :)

But i note your commits also are not verified and they must be able to memerged

@PrakharJain1509
Copy link
Author

Thanks, I'll take a look. Sorry it will take some time If this is your only oustanding issue and you have met the requirements otheriwse, feel free to find another issue :)

But i note your commits also are not verified and they must be able to memerged

No I mean I wanted the reviews before October end so that it can be counted in hacktober.. So thats why

@exploreriii
Copy link
Contributor

Yes but we have other hacktoberfest review requests before you, which is the issue

@PrakharJain1509
Copy link
Author

Yes but we have other hacktoberfest review requests before you, which is the issue

Okay.. Please try to do it as soon as possible.. also is there something I can do to make it faster?

@exploreriii
Copy link
Contributor

This issue you chose takes longer to review because it impacts core sdk functionality, rather than just examples or docstrings. Sorry, it needs to take the time it needs

@PrakharJain1509
Copy link
Author

Okay sure

@exploreriii
Copy link
Contributor

Hi @PrakharJain1509
Approved by myself, can you please rebase as the changelog has updated (you'll need to read merge_conflicts.md)
Than k you so much

@PrakharJain1509
Copy link
Author

@exploreriii Just check now.. got a small issue on PR Formatting

Signed-off-by: prakharjain <[email protected]>
@PrakharJain1509 PrakharJain1509 force-pushed the fix-add-repr-to-custom-fee-base branch from 9ba0c1a to 73d80fb Compare October 28, 2025 00:33
@PrakharJain1509
Copy link
Author

@exploreriii Okay done now..

@PrakharJain1509
Copy link
Author

@exploreriii please let me know if anything else is required.

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HI @PrakharJain1509 I didn't see any changes?
Please note half of your commits are not verified, you must ensure each commit has
git commit -S -s -m "chore: your commit message"

@exploreriii
Copy link
Contributor

You can either pick at those commits and resign them or you can try to soft revert, please see attahcment
Screenshot 2025-10-28 at 09 44 45

@nadineloepfe
Copy link
Contributor

Hi @PrakharJain1509
Are you still working on this issue/PR? thanks

@exploreriii
Copy link
Contributor

Hi @PrakharJain1509 , this PR is a dependency on another PR, could you confirm if you are planning on continuing to work on this, or if we can take it on building on your work?

@exploreriii
Copy link
Contributor

Closing PR and re-assigning as is inactive for now

@exploreriii exploreriii closed this Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create _repr method in src/hiero_sdk_python/tokens/custom_fee.py

3 participants